extends Area2D
class_name OrganButton

@export var pressed_texture:Texture2D
@export var released_texture:Texture2D
@onready var sprite_2d: Sprite2D = $Sprite2D

signal pressed
signal released

var is_pressed:bool = false

func _ready() -> void:
	body_entered.connect(func(body:Node2D):
		if !is_pressed:
			sprite_2d.texture = pressed_texture
			is_pressed = true
			pressed.emit()
		)
	body_exited.connect(func(body:Node2D):
		if is_pressed:
			sprite_2d.texture = released_texture
			is_pressed = false
			released.emit()
		)
